.chatbot {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* background: linear-gradient(135deg, #6a93ff 0%, #a4c2ff 25%, #f8b4e0 50%, #a4c2ff 75%, #6a93ff 100%); */
}

.chatbot-layout {
  display: flex;
  height: 100%;
  flex: 1;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}


.chat-main.with-sidebar {
  margin-left: 0;
}

.chat-main.full-width {
  margin-left: 0;
}

/* 头部标题优化 */
.chat-header {
  padding: 12px 24px;
  border-bottom: 1px solid rgba(168, 130, 255, 0.2); /* 淡紫色边框 */
  background: rgba(196, 192, 255, 0.55);
  backdrop-filter: blur(5px); /* 毛玻璃效果 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 标题文本渐变效果 */
.chat-header-left h2 {
  background: linear-gradient(90deg, #6a93ff, #a855f7);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

/* 标题左侧打开消息列表按钮 */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.sidebar-toggle:hover {
  background: #f5f5f5;
}

/* 标题下面的对话框容器 */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  background: rgba(196, 192, 255, 0.55);
}

/* 对话框容器下面的消息容器（随着对话内容而变化） */
.messages-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 160px);
  padding-bottom: 55px;
  background: transparent;
}

/* 空白状态优化 */
.empty-state-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.5); /* 半透明白色背景 */
  border-radius: 12px;
  margin: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.empty-state-container .ant-empty-description {
  color: #6a93ff; /* 主色调蓝色 */
  font-size: 24px;
  font-weight: 500;
}

/* 有消息时的消息列表容器（位于消息容器下面） */
.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  height: 100%;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: #d9d9d9 transparent;
}

/* WebKit滚动条样式 */
.messages-list::-webkit-scrollbar {
  width: 6px;
}

.messages-list::-webkit-scrollbar-track {
  background: transparent;
}

/* 滚动条优化 */
.messages-list::-webkit-scrollbar-thumb {
  background: rgba(168, 130, 255, 0.5); /* 淡紫色 */
  border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

.message-item {
  display: flex;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease-in;
}

.message-item.user-message {
  flex-direction: row-reverse;
}

.message-item.user-message .message-content {
  margin-right: 12px;
  margin-left: 0;
}

.message-item.ai-message .message-content {
  margin-left: 12px;
  margin-right: 0;
}

/* 消息列表中的AI头像 */
.robot-avatar {
  flex-shrink: 0;
  font-size: 18px;
  color:#1890ff;
}

.message-content {
  max-width: 70%;
  min-width: 200px;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-sender {
  font-weight: 500;
  font-size: 16px;
  color: #666;
}

.message-time {
  font-size: 14px;
  color: #999;
}

/* 消息气泡优化 */
.message-text {
  background: rgba(245, 245, 245, 0.8); /* 半透明白色 */
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 2.2;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  backdrop-filter: blur(5px); /* 毛玻璃效果 */
  font-size:medium;
}

.user-message .message-text {
  background: rgba(170, 227, 255, 0.4);
  color: black;
}
.ai-message .message-text {
  background: rgba(255,255,255,0.5);
  color: black;
}

.error-message .message-text {
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: #ff4d4f;
}

/* Markdown样式 */
.markdown-content {
  width: 100%;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 6px 0 2px 0;
  font-weight: 600;
}

.message-text h1 { font-size: 1.2em; }
.message-text h2 { font-size: 1.1em; }
.message-text h3 { font-size: 1.05em; }
.message-text h4,
.message-text h5,
.message-text h6 { font-size: 1em; }

.message-text p,
.markdown-content p {
  margin: 3px 0;
  line-height: 1.5;
}

.message-text .markdown-content p {
  margin: 3px 0;
  line-height: 1.5;
}

.message-text ul,
.message-text ol,
.markdown-content ul,
.markdown-content ol,
.message-text .markdown-content ul,
.message-text .markdown-content ol {
  margin: 4px 0;
  padding-left: 20px;
}

.message-text li,
.markdown-content li,
.message-text .markdown-content li {
  margin: 2px 0;
  line-height: 1.5;
}

.message-text code,
.markdown-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.message-text pre,
.markdown-content pre {
  background: rgba(0, 0, 0, 0.06);
  padding: 8px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
}

.message-text pre code,
.markdown-content pre code {
  background: none;
  padding: 0;
}

.message-text blockquote,
.markdown-content blockquote {
  border-left: 3px solid #d9d9d9;
  margin: 8px 0;
  padding-left: 12px;
  color: #666;
}

.message-text table,
.markdown-content table,
.message-text .markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  border: 1px solid #d9d9d9;
  font-size: 14px;
  line-height: 1.5;
  table-layout: auto;
  overflow-x: auto;
  display: table;
}

.message-text th,
.message-text td,
.markdown-content th,
.markdown-content td,
.message-text .markdown-content th,
.message-text .markdown-content td {
  border: 1px solid #d9d9d9;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  min-width: 120px;
}

.message-text th,
.markdown-content th,
.message-text .markdown-content th {
  background: #f8f9fa;
  font-weight: 600;
  border-bottom: 2px solid #d9d9d9;
  color: #333;
  text-align: center;
}

.message-text tbody tr:nth-child(even),
.markdown-content tbody tr:nth-child(even),
.message-text .markdown-content tbody tr:nth-child(even) {
  background: #fafbfc;
}

.message-text tbody tr:hover,
.markdown-content tbody tr:hover,
.message-text .markdown-content tbody tr:hover {
  background: #f0f2f5;
}

/* 表格容器，支持横向滚动 */
.message-text .markdown-content,
.markdown-content {
  overflow-x: auto;
  max-width: 100%;
}

/* 针对窄屏设备的表格优化 */
@media (max-width: 768px) {
  .message-text table,
  .markdown-content table,
  .message-text .markdown-content table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .message-text th,
  .message-text td,
  .markdown-content th,
  .markdown-content td,
  .message-text .markdown-content th,
  .message-text .markdown-content td {
    padding: 8px 10px;
    min-width: 100px;
  }
}

.message-text strong,
.markdown-content strong {
  font-weight: 600;
}

.message-text em,
.markdown-content em {
  font-style: italic;
}

.message-text a,
.markdown-content a {
  color: #1890ff;
  text-decoration: none;
}

.message-text a:hover,
.markdown-content a:hover {
  text-decoration: underline;
}

/* 输入区域容器 */
.input-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: transparent;
  display: flex;
  justify-content: center;
  z-index: 1000;
}

/* 输入框容器 */
.floating-input-box {
  background: rgba(255, 255, 255, 0.9); /* 半透明白色背景 */
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(106, 147, 255, 0.2); /* 蓝色阴影 */
  border: 1px solid rgba(168, 130, 255, 0.3); /* 淡紫色边框 */
  padding: 16px;
  max-width: 800px;
  width: 100%;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px); /* 毛玻璃效果 */
}

.floating-input-box:hover {
  box-shadow: 0 12px 40px rgba(106, 147, 255, 0.3);
  border-color: blue;
}

/* 输入内容和发送按钮容器 */
.input-main {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  /* margin-bottom: 12px; */
}

/* 用户输入框 */
.floating-textarea {
  flex: 1;
  border: none;
  box-shadow: none;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  background: transparent;
}

.floating-textarea:focus {
  border: none;
  box-shadow: none;
}

.floating-textarea .ant-input {
  border: none;
  box-shadow: none;
  padding: 8px 0;
}

/* 发送按钮 */
.floating-send-button {
  border-radius: 12px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #4D6BFE;
}

/* 控制按钮大容器 */
.input-controls {
  padding-top: 12px;
}
/* 控制按钮小容器 */
.control-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 控制按钮——搜索、深度思考、个性化推荐 */
.control-btn {
  border-radius: 16px;
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.7); /* 半透明背景 */
  border: 2px solid rgba(168, 130, 255, 0.2); /* 淡紫色边框 */
}

.control-btn.active {
  background: rgba(168, 130, 255, 0.2); 
  color: #4B006E;
  border-color: transparent;
}

.control-btn:not(.active):hover {
  color: #4B006E;
  background: #f5f5f5;
  border-color: #d9d9d9;
}

/* 控制按钮——清空历史 */
.control-btn.clear-btn {
  color: #666;
  font-size: 13px;
  border: 1px solid #d9d9d9;
  background: white;
}

.control-btn.clear-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #d9d9d9;
  color: #ff4d4f;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-header {
    padding: 12px 16px;
  }
  
  .message-content {
    max-width: 85%;
    min-width: 150px;
  }
  
  .input-container {
    padding: 12px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
  }
  
  .floating-input-box {
    margin: 0 8px;
    max-width: calc(100% - 16px);
    border-radius: 20px;
    padding: 12px;
  }
  
  .control-buttons {
    gap: 6px;
  }
  
  .control-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }
  
  .floating-send-button {
    height: 36px;
    padding: 0 12px;
  }
  
  .sidebar-toggle {
    width: 28px;
    height: 28px;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .chat-main {
    margin: 8px;
  }
  
  .floating-input-box {
    border-radius: 20px;
    padding: 12px;
  }
  
  .empty-state-container {
    margin: 8px;
  }
}